package com.briup.MR.NoMapReduce;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.TextInputFormat;
import org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

/**
 * TODO
 *
 * @author 最美如初
 * @version 1.0
 * @date 2021/7/20
 * @description
 */
public class NoMapperAndReducer extends Configured implements Tool {
    public int run(String[] strings) throws Exception {
        Configuration conf = getConf();
        String input = conf.get("input");
        String output = conf.get("output");

        Job job = Job.getInstance(conf);
        job.setJarByClass(NoMapperAndReducer.class);
        job.setJobName("NoMapperAndReducer");

        TextInputFormat.addInputPath(job,new Path(input));
        TextOutputFormat.setOutputPath(job,new Path(output));

        return job.waitForCompletion(true)?0:-1;
    }

    public static void main(String[] args) throws Exception {
        System.exit(new ToolRunner().run(new NoMapperAndReducer(),args));
    }
}
